home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / ada / gnat-3.05- / gnat-3 / gnat-3.05-i486-linux-elf-bin / doconfig < prev    next >
Encoding:
Text File  |  1996-06-11  |  5.3 KB  |  217 lines

  1. #!/bin/bash
  2.  
  3. # -------  fin -------
  4. function fin() {
  5.   rm -f $outname
  6.   mv $tmpout $outname
  7.   chmod +x $outname
  8.   echo    Configuration complete.  Run $outname to do the installation.
  9.   echo    DO NOT FORGET: put $bindir at the front of your PATH
  10.   echo ""
  11.   exit
  12. }
  13.  
  14. function no-gccinstall() {
  15.   cat << EOF
  16.   GCC-$basever not installed in standard locations.
  17.   cannot do this type of installation
  18. EOF
  19.   rm -f $outname
  20.   exit 1
  21. }
  22.  
  23. function no-stdinstall() {
  24.   cat << EOF
  25.   Some GCC-$basever files were found.  They should be removed before
  26.   using this option, or you should choose another option.
  27. EOF
  28.   rm -f $outname
  29.   exit 1
  30. }
  31.  
  32. # --------------------------- Option 1 selected -----------------------
  33. function install-top() {
  34.   clear
  35.   prefix=/usr
  36.   bindir=$prefix/bin
  37.   libsubdir=$prefix/lib/gcc-lib/$machine/$basever
  38.   if [ ! -d $bindir ]; then no-gccinstall; fi
  39.   if [ ! -f $bindir/gcc ]; then no-gccinstall; fi
  40.   top_basever=`$bindir/gcc -dumpversion`
  41.   top_machine=`$bindir/gcc -dumpmachine`
  42.   top_libsubdir=$prefix/lib/gcc-lib/$top_machine/$top_basever
  43.   if [ ! -d $top_libsubdir ]; then no-gccinstall; fi
  44.   if [ $libsubdir != $top_libsubdir ]; then \
  45.     ln -s $libsubdir $top_libsubdir || exit 1;\
  46.   fi
  47.   cat << EOF
  48.     The installation on top of GCC-$basever will install:
  49.       In $bindir :
  50.           gnatbind gnatbl gnatf
  51.  
  52.       In $libsubdir :
  53.           gnat1
  54.           libgnat.a, and libgthreads.a
  55.  
  56.       In $prefix/adainclude :
  57.           The source files of the RTL
  58.  
  59.       In $libsubdir/adalib :
  60.           The object files of the RTL
  61. EOF
  62.   echo make ins-gnatstuff >$tmpout
  63.   fin
  64. }
  65.  
  66. # --------------------------- Option 2 selected -----------------------
  67. function install-std() {
  68.   clear
  69.   prefix=/usr
  70.   bindir=$prefix/bin
  71.   libsubdir=$prefix/lib/gcc-lib/$machine/$basever
  72.   if [ -d $libsubdir ]; then no-stdinstall; fi
  73.   cat << EOF
  74.     The installation in the GCC standard locations will install:
  75.       In $bindir :
  76.           gcc gnatbind gnatbl
  77.  
  78.       In $libsubdir :
  79.           gnat1 cc1 cpp ld libgcc.a specs
  80.           libgnat.a, and libgthreads.a
  81.  
  82.       In $prefix/adainclude :
  83.           The source files of the RTL
  84.  
  85.       In $libsubdir/adalib :
  86.           The object files of the RTL
  87. EOF
  88.   echo make ins-all >$tmpout
  89.   fin
  90. }
  91.  
  92. # --------------------------- Option 3 selected -----------------------
  93. function install-non() {
  94.   clear
  95.   cat << EOF
  96.  
  97.  
  98.     To install GNAT is a non-standard location you need to specify a
  99.     base directory.  All the files will be installed in subdirectories
  100.     that are created under this directory.
  101.  
  102.     Specify the base directory you want to use for installation:
  103.  
  104. EOF
  105.   read basedir
  106.   while true; do
  107.     if [ X = X`echo $basedir|sed -n -e 's%^/.*%/%p'` ]; then\
  108.       basedir=`pwd`/$basedir;\
  109.     fi;\
  110.     echo "    The base directory is $basedir";\
  111.     echo "    To accept this choice enter RETURN.";\
  112.     echo "    Otherwise type a new name.";\
  113.     read answer;\
  114.     if [ X$answer = X ]; then break; fi;\
  115.     basedir=$answer;\
  116.   done
  117.   clear
  118.   prefix=$basedir
  119.   bindir=$prefix/bin
  120.   libsubdir=$prefix/lib/gcc-lib/$machine/$basever
  121.   cat << EOF
  122.  
  123.     The installation of GNAT will install:
  124.       In $bindir :
  125.           gcc gnatbind gnatbl
  126.  
  127.       In $libsubdir :
  128.           gnat1 cc1 cpp ld libgcc.a specs
  129.           libgnat.a, and libgthreads.a
  130.  
  131.       In $prefix/adainclude :
  132.           The source files of the RTL
  133.  
  134.       In $libsubdir/adalib :
  135.           The object files of the RTL
  136.  
  137. EOF
  138.   echo make ins-all prefix=$prefix >$tmpout
  139.  
  140.   cat << EOF >env-vals
  141. export GCC_EXEC_PREFIX=$libsubdir/
  142. export ADA_INCLUDE_PATH=$prefix/adainclude
  143. export ADA_OBJECTS_PATH=$libsubdir/adalib
  144. export C_INCLUDE_PATH=$libsubdir/include
  145. EOF
  146.  
  147.   cat << EOF
  148.     The file env-vals has been created.  It contains the csh commands
  149.     to set the environment variables you need to use GNAT.  These
  150.     commands (or their equivalent for the shell you use) should be
  151.     placed in your .cshrc (or equivalent) file.
  152.  
  153. EOF
  154. fin
  155. }
  156.  
  157. basever=`./xgcc -dumpversion`
  158. machine=`./xgcc -dumpmachine`
  159. outname=doinstall
  160. tmpout=tmp-doinstall
  161.  
  162. rm -f $tmpout
  163.  
  164. cat << EOF
  165.  
  166.  
  167.   This script is provided to simplify the installation of the $machine
  168.   binary version of the GNU NYU Ada Translator (GNAT).
  169.  
  170.   This script asks a few questions about how you want GNAT configured
  171.   and then creates a file in this directory which can then be invoked
  172.   to do the actual installation.  Running this configuration script will
  173.   not modify anything anywhere else in your system.  You can break
  174.   out of it or run it multiple times before doing the actual installation.
  175.  
  176.   Hit RETURN to continue.
  177. EOF
  178.  
  179. read
  180. clear
  181. cat << EOF
  182.  
  183.  
  184.   There are basically 3 options for installation:
  185.  
  186.   1) Install GNAT-specific files on top of an existing GCC $basever
  187.      installation (must be in standard locations -- will likely
  188.      require root permission).
  189.  
  190.   2) Install GCC C compiler and GNAT files in the standard  GCC locations.
  191.      (Note: This includes directories under /usr.  On most
  192.       systems, this requires root permission).
  193.  
  194.   3) Install GCC C compiler and GNAT files in non-standard locations
  195.      that you will specify.
  196.  
  197.  
  198.   Options 1 and 2 provide simplest and most flexible use of GNAT.
  199.   Option 3 requires users to set some environment variables.
  200.  
  201. EOF
  202. while true; do \
  203.   echo Type 1, 2, or 3 "(then RETURN)" to choose an option:; \
  204.   read answer; \
  205.   case $answer in \
  206.   1)\
  207.     install-top\
  208.     ;;\
  209.   2)\
  210.     install-std\
  211.     ;;\
  212.   3)\
  213.     install-non\
  214.     ;;\
  215.   esac;\
  216. done
  217.